package recorder

import (
	"context"
	v1 "hotgo/api/api/recorder/v1"
	"hotgo/internal/dao"
	"hotgo/internal/model/do"

	"github.com/gogf/gf/v2/frame/g"

	"github.com/gogf/gf/v2/os/gtime"
)

func (c *ControllerV1) Publish(ctx context.Context, req *v1.PublishReq) (res *v1.PublishRes, err error) {
	_, errs := dao.Record.Ctx(ctx).Data(do.Record{
		Name:       req.Name,
		RecordTime: gtime.Now(),
	}).Insert()
	if nil != errs {
		g.Log().Warningf(ctx, "机位%s publish回调更新开始时间出现错误:%v!\n", req.Name, errs.Error())
	}
	return nil, nil
}
